
/**
 * This is a generated class and is not intended for modification.  
 */
package com.model.valueObjects
{
import com.adobe.fiber.styles.IStyle;
import com.adobe.fiber.styles.Style;
import com.adobe.fiber.styles.StyleValidator;
import com.adobe.fiber.valueobjects.AbstractEntityMetadata;
import com.adobe.fiber.valueobjects.AvailablePropertyIterator;
import com.adobe.fiber.valueobjects.IPropertyIterator;
import mx.events.ValidationResultEvent;
import com.adobe.fiber.core.model_internal;
import com.adobe.fiber.valueobjects.IModelType;
import mx.events.PropertyChangeEvent;

use namespace model_internal;

[ExcludeClass]
internal class _VoFreeAllocatedEntityMetadata extends com.adobe.fiber.valueobjects.AbstractEntityMetadata
{
    private static var emptyArray:Array = new Array();

    model_internal static var allProperties:Array = new Array("pro_name", "expected_datetime", "po_id", "pro_qty", "stamp_number", "free_for_allocated", "part_number", "allocated_qty", "po_detserialnumber", "po_confirm_date");
    model_internal static var allAssociationProperties:Array = new Array();
    model_internal static var allRequiredProperties:Array = new Array("pro_name", "expected_datetime", "po_id", "pro_qty", "stamp_number", "free_for_allocated", "part_number", "allocated_qty", "po_detserialnumber", "po_confirm_date");
    model_internal static var allAlwaysAvailableProperties:Array = new Array("pro_name", "expected_datetime", "po_id", "pro_qty", "stamp_number", "free_for_allocated", "part_number", "allocated_qty", "po_detserialnumber", "po_confirm_date");
    model_internal static var guardedProperties:Array = new Array();
    model_internal static var dataProperties:Array = new Array("pro_name", "expected_datetime", "po_id", "pro_qty", "stamp_number", "free_for_allocated", "part_number", "allocated_qty", "po_detserialnumber", "po_confirm_date");
    model_internal static var derivedProperties:Array = new Array();
    model_internal static var collectionProperties:Array = new Array();
    model_internal static var collectionBaseMap:Object;
    model_internal static var entityName:String = "VoFreeAllocated";
    model_internal static var dependentsOnMap:Object;
    model_internal static var dependedOnServices:Array = new Array();

    
    model_internal var _pro_nameIsValid:Boolean;
    model_internal var _pro_nameValidator:com.adobe.fiber.styles.StyleValidator;
    model_internal var _pro_nameIsValidCacheInitialized:Boolean = false;
    model_internal var _pro_nameValidationFailureMessages:Array;
    
    model_internal var _expected_datetimeIsValid:Boolean;
    model_internal var _expected_datetimeValidator:com.adobe.fiber.styles.StyleValidator;
    model_internal var _expected_datetimeIsValidCacheInitialized:Boolean = false;
    model_internal var _expected_datetimeValidationFailureMessages:Array;
    
    model_internal var _po_idIsValid:Boolean;
    model_internal var _po_idValidator:com.adobe.fiber.styles.StyleValidator;
    model_internal var _po_idIsValidCacheInitialized:Boolean = false;
    model_internal var _po_idValidationFailureMessages:Array;
    
    model_internal var _stamp_numberIsValid:Boolean;
    model_internal var _stamp_numberValidator:com.adobe.fiber.styles.StyleValidator;
    model_internal var _stamp_numberIsValidCacheInitialized:Boolean = false;
    model_internal var _stamp_numberValidationFailureMessages:Array;
    
    model_internal var _part_numberIsValid:Boolean;
    model_internal var _part_numberValidator:com.adobe.fiber.styles.StyleValidator;
    model_internal var _part_numberIsValidCacheInitialized:Boolean = false;
    model_internal var _part_numberValidationFailureMessages:Array;
    
    model_internal var _po_confirm_dateIsValid:Boolean;
    model_internal var _po_confirm_dateValidator:com.adobe.fiber.styles.StyleValidator;
    model_internal var _po_confirm_dateIsValidCacheInitialized:Boolean = false;
    model_internal var _po_confirm_dateValidationFailureMessages:Array;

    model_internal var _instance:_Super_VoFreeAllocated;
    model_internal static var _nullStyle:com.adobe.fiber.styles.Style = new com.adobe.fiber.styles.Style();

    public function _VoFreeAllocatedEntityMetadata(value : _Super_VoFreeAllocated)
    {
        // initialize property maps
        if (model_internal::dependentsOnMap == null)
        {
            // depenents map
            model_internal::dependentsOnMap = new Object();
            model_internal::dependentsOnMap["pro_name"] = new Array();
            model_internal::dependentsOnMap["expected_datetime"] = new Array();
            model_internal::dependentsOnMap["po_id"] = new Array();
            model_internal::dependentsOnMap["pro_qty"] = new Array();
            model_internal::dependentsOnMap["stamp_number"] = new Array();
            model_internal::dependentsOnMap["free_for_allocated"] = new Array();
            model_internal::dependentsOnMap["part_number"] = new Array();
            model_internal::dependentsOnMap["allocated_qty"] = new Array();
            model_internal::dependentsOnMap["po_detserialnumber"] = new Array();
            model_internal::dependentsOnMap["po_confirm_date"] = new Array();

            // collection base map
            model_internal::collectionBaseMap = new Object()
        }

        model_internal::_instance = value;
        model_internal::_pro_nameValidator = new StyleValidator(model_internal::_instance.model_internal::_doValidationForPro_name);
        model_internal::_pro_nameValidator.required = true;
        model_internal::_pro_nameValidator.requiredFieldError = "pro_name is required";
        //model_internal::_pro_nameValidator.source = model_internal::_instance;
        //model_internal::_pro_nameValidator.property = "pro_name";
        model_internal::_expected_datetimeValidator = new StyleValidator(model_internal::_instance.model_internal::_doValidationForExpected_datetime);
        model_internal::_expected_datetimeValidator.required = true;
        model_internal::_expected_datetimeValidator.requiredFieldError = "expected_datetime is required";
        //model_internal::_expected_datetimeValidator.source = model_internal::_instance;
        //model_internal::_expected_datetimeValidator.property = "expected_datetime";
        model_internal::_po_idValidator = new StyleValidator(model_internal::_instance.model_internal::_doValidationForPo_id);
        model_internal::_po_idValidator.required = true;
        model_internal::_po_idValidator.requiredFieldError = "po_id is required";
        //model_internal::_po_idValidator.source = model_internal::_instance;
        //model_internal::_po_idValidator.property = "po_id";
        model_internal::_stamp_numberValidator = new StyleValidator(model_internal::_instance.model_internal::_doValidationForStamp_number);
        model_internal::_stamp_numberValidator.required = true;
        model_internal::_stamp_numberValidator.requiredFieldError = "stamp_number is required";
        //model_internal::_stamp_numberValidator.source = model_internal::_instance;
        //model_internal::_stamp_numberValidator.property = "stamp_number";
        model_internal::_part_numberValidator = new StyleValidator(model_internal::_instance.model_internal::_doValidationForPart_number);
        model_internal::_part_numberValidator.required = true;
        model_internal::_part_numberValidator.requiredFieldError = "part_number is required";
        //model_internal::_part_numberValidator.source = model_internal::_instance;
        //model_internal::_part_numberValidator.property = "part_number";
        model_internal::_po_confirm_dateValidator = new StyleValidator(model_internal::_instance.model_internal::_doValidationForPo_confirm_date);
        model_internal::_po_confirm_dateValidator.required = true;
        model_internal::_po_confirm_dateValidator.requiredFieldError = "po_confirm_date is required";
        //model_internal::_po_confirm_dateValidator.source = model_internal::_instance;
        //model_internal::_po_confirm_dateValidator.property = "po_confirm_date";
    }

    override public function getEntityName():String
    {
        return model_internal::entityName;
    }

    override public function getProperties():Array
    {
        return model_internal::allProperties;
    }

    override public function getAssociationProperties():Array
    {
        return model_internal::allAssociationProperties;
    }

    override public function getRequiredProperties():Array
    {
         return model_internal::allRequiredProperties;   
    }

    override public function getDataProperties():Array
    {
        return model_internal::dataProperties;
    }

    override public function getGuardedProperties():Array
    {
        return model_internal::guardedProperties;
    }

    override public function getUnguardedProperties():Array
    {
        return model_internal::allAlwaysAvailableProperties;
    }

    override public function getDependants(propertyName:String):Array
    {
       if (model_internal::dataProperties.indexOf(propertyName) == -1)
            throw new Error(propertyName + " is not a data property of entity VoFreeAllocated");  
            
       return model_internal::dependentsOnMap[propertyName] as Array;  
    }

    override public function getDependedOnServices():Array
    {
        return model_internal::dependedOnServices;
    }

    override public function getCollectionProperties():Array
    {
        return model_internal::collectionProperties;
    }

    override public function getCollectionBase(propertyName:String):String
    {
        if (model_internal::collectionProperties.indexOf(propertyName) == -1)
            throw new Error(propertyName + " is not a collection property of entity VoFreeAllocated");  

        return model_internal::collectionBaseMap[propertyName];
    }

    override public function getAvailableProperties():com.adobe.fiber.valueobjects.IPropertyIterator
    {
        return new com.adobe.fiber.valueobjects.AvailablePropertyIterator(this);
    }

    override public function getValue(propertyName:String):*
    {
        if (model_internal::allProperties.indexOf(propertyName) == -1)
        {
            throw new Error(propertyName + " does not exist for entity VoFreeAllocated");
        }

        return model_internal::_instance[propertyName];
    }

    override public function setValue(propertyName:String, value:*):void
    {
        if (model_internal::dataProperties.indexOf(propertyName) == -1)
        {
            throw new Error(propertyName + " is not a data property of entity VoFreeAllocated");
        }

        model_internal::_instance[propertyName] = value;
    }

    override public function getMappedByProperty(associationProperty:String):String
    {
        switch(associationProperty)
        {
            default:
            {
                return null;
            }
        }
    }

    override public function getPropertyLength(propertyName:String):int
    {
        switch(propertyName)
        {
            default:
            {
                return 0;
            }
        }
    }

    override public function isAvailable(propertyName:String):Boolean
    {
        if (model_internal::allProperties.indexOf(propertyName) == -1)
        {
            throw new Error(propertyName + " does not exist for entity VoFreeAllocated");
        }

        if (model_internal::allAlwaysAvailableProperties.indexOf(propertyName) != -1)
        {
            return true;
        }

        switch(propertyName)
        {
            default:
            {
                return true;
            }
        }
    }

    override public function getIdentityMap():Object
    {
        var returnMap:Object = new Object();

        return returnMap;
    }

    [Bindable(event="propertyChange")]
    override public function get invalidConstraints():Array
    {
        if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
        {
            return model_internal::_instance.model_internal::_invalidConstraints;
        }
        else
        {
            // recalculate isValid
            model_internal::_instance.model_internal::_isValid = model_internal::_instance.model_internal::calculateIsValid();
            return model_internal::_instance.model_internal::_invalidConstraints;        
        }
    }

    [Bindable(event="propertyChange")]
    override public function get validationFailureMessages():Array
    {
        if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
        {
            return model_internal::_instance.model_internal::_validationFailureMessages;
        }
        else
        {
            // recalculate isValid
            model_internal::_instance.model_internal::_isValid = model_internal::_instance.model_internal::calculateIsValid();
            return model_internal::_instance.model_internal::_validationFailureMessages;
        }
    }

    override public function getDependantInvalidConstraints(propertyName:String):Array
    {
        var dependants:Array = getDependants(propertyName);
        if (dependants.length == 0)
        {
            return emptyArray;
        }

        var currentlyInvalid:Array = invalidConstraints;
        if (currentlyInvalid.length == 0)
        {
            return emptyArray;
        }

        var filterFunc:Function = function(element:*, index:int, arr:Array):Boolean
        {
            return dependants.indexOf(element) > -1;
        }

        return currentlyInvalid.filter(filterFunc);
    }

    /**
     * isValid
     */
    [Bindable(event="propertyChange")] 
    public function get isValid() : Boolean
    {
        if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
        {
            return model_internal::_instance.model_internal::_isValid;
        }
        else
        {
            // recalculate isValid
            model_internal::_instance.model_internal::_isValid = model_internal::_instance.model_internal::calculateIsValid();
            return model_internal::_instance.model_internal::_isValid;
        }
    }

    [Bindable(event="propertyChange")]
    public function get isPro_nameAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isExpected_datetimeAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isPo_idAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isPro_qtyAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isStamp_numberAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isFree_for_allocatedAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isPart_numberAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isAllocated_qtyAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isPo_detserialnumberAvailable():Boolean
    {
        return true;
    }

    [Bindable(event="propertyChange")]
    public function get isPo_confirm_dateAvailable():Boolean
    {
        return true;
    }


    /**
     * derived property recalculation
     */
    public function invalidateDependentOnPro_name():void
    {
        if (model_internal::_pro_nameIsValidCacheInitialized )
        {
            model_internal::_instance.model_internal::_doValidationCacheOfPro_name = null;
            model_internal::calculatePro_nameIsValid();
        }
    }
    public function invalidateDependentOnExpected_datetime():void
    {
        if (model_internal::_expected_datetimeIsValidCacheInitialized )
        {
            model_internal::_instance.model_internal::_doValidationCacheOfExpected_datetime = null;
            model_internal::calculateExpected_datetimeIsValid();
        }
    }
    public function invalidateDependentOnPo_id():void
    {
        if (model_internal::_po_idIsValidCacheInitialized )
        {
            model_internal::_instance.model_internal::_doValidationCacheOfPo_id = null;
            model_internal::calculatePo_idIsValid();
        }
    }
    public function invalidateDependentOnStamp_number():void
    {
        if (model_internal::_stamp_numberIsValidCacheInitialized )
        {
            model_internal::_instance.model_internal::_doValidationCacheOfStamp_number = null;
            model_internal::calculateStamp_numberIsValid();
        }
    }
    public function invalidateDependentOnPart_number():void
    {
        if (model_internal::_part_numberIsValidCacheInitialized )
        {
            model_internal::_instance.model_internal::_doValidationCacheOfPart_number = null;
            model_internal::calculatePart_numberIsValid();
        }
    }
    public function invalidateDependentOnPo_confirm_date():void
    {
        if (model_internal::_po_confirm_dateIsValidCacheInitialized )
        {
            model_internal::_instance.model_internal::_doValidationCacheOfPo_confirm_date = null;
            model_internal::calculatePo_confirm_dateIsValid();
        }
    }

    model_internal function fireChangeEvent(propertyName:String, oldValue:Object, newValue:Object):void
    {
        this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, propertyName, oldValue, newValue));
    }

    [Bindable(event="propertyChange")]   
    public function get pro_nameStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    public function get pro_nameValidator() : StyleValidator
    {
        return model_internal::_pro_nameValidator;
    }

    model_internal function set _pro_nameIsValid_der(value:Boolean):void 
    {
        var oldValue:Boolean = model_internal::_pro_nameIsValid;         
        if (oldValue !== value)
        {
            model_internal::_pro_nameIsValid = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "pro_nameIsValid", oldValue, value));
        }                             
    }

    [Bindable(event="propertyChange")]
    public function get pro_nameIsValid():Boolean
    {
        if (!model_internal::_pro_nameIsValidCacheInitialized)
        {
            model_internal::calculatePro_nameIsValid();
        }

        return model_internal::_pro_nameIsValid;
    }

    model_internal function calculatePro_nameIsValid():void
    {
        var valRes:ValidationResultEvent = model_internal::_pro_nameValidator.validate(model_internal::_instance.pro_name)
        model_internal::_pro_nameIsValid_der = (valRes.results == null);
        model_internal::_pro_nameIsValidCacheInitialized = true;
        if (valRes.results == null)
             model_internal::pro_nameValidationFailureMessages_der = emptyArray;
        else
        {
            var _valFailures:Array = new Array();
            for (var a:int = 0 ; a<valRes.results.length ; a++)
            {
                _valFailures.push(valRes.results[a].errorMessage);
            }
            model_internal::pro_nameValidationFailureMessages_der = _valFailures;
        }
    }

    [Bindable(event="propertyChange")]
    public function get pro_nameValidationFailureMessages():Array
    {
        if (model_internal::_pro_nameValidationFailureMessages == null)
            model_internal::calculatePro_nameIsValid();

        return _pro_nameValidationFailureMessages;
    }

    model_internal function set pro_nameValidationFailureMessages_der(value:Array) : void
    {
        var oldValue:Array = model_internal::_pro_nameValidationFailureMessages;

        var needUpdate : Boolean = false;
        if (oldValue == null)
            needUpdate = true;
    
        // avoid firing the event when old and new value are different empty arrays
        if (!needUpdate && (oldValue !== value && (oldValue.length > 0 || value.length > 0)))
        {
            if (oldValue.length == value.length)
            {
                for (var a:int=0; a < oldValue.length; a++)
                {
                    if (oldValue[a] !== value[a])
                    {
                        needUpdate = true;
                        break;
                    }
                }
            }
            else
            {
                needUpdate = true;
            }
        }

        if (needUpdate)
        {
            model_internal::_pro_nameValidationFailureMessages = value;   
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "pro_nameValidationFailureMessages", oldValue, value));
            // Only execute calculateIsValid if it has been called before, to update the validationFailureMessages for
            // the entire entity.
            if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
            {
                model_internal::_instance.model_internal::isValid_der = model_internal::_instance.model_internal::calculateIsValid();
            }
        }
    }

    [Bindable(event="propertyChange")]   
    public function get expected_datetimeStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    public function get expected_datetimeValidator() : StyleValidator
    {
        return model_internal::_expected_datetimeValidator;
    }

    model_internal function set _expected_datetimeIsValid_der(value:Boolean):void 
    {
        var oldValue:Boolean = model_internal::_expected_datetimeIsValid;         
        if (oldValue !== value)
        {
            model_internal::_expected_datetimeIsValid = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "expected_datetimeIsValid", oldValue, value));
        }                             
    }

    [Bindable(event="propertyChange")]
    public function get expected_datetimeIsValid():Boolean
    {
        if (!model_internal::_expected_datetimeIsValidCacheInitialized)
        {
            model_internal::calculateExpected_datetimeIsValid();
        }

        return model_internal::_expected_datetimeIsValid;
    }

    model_internal function calculateExpected_datetimeIsValid():void
    {
        var valRes:ValidationResultEvent = model_internal::_expected_datetimeValidator.validate(model_internal::_instance.expected_datetime)
        model_internal::_expected_datetimeIsValid_der = (valRes.results == null);
        model_internal::_expected_datetimeIsValidCacheInitialized = true;
        if (valRes.results == null)
             model_internal::expected_datetimeValidationFailureMessages_der = emptyArray;
        else
        {
            var _valFailures:Array = new Array();
            for (var a:int = 0 ; a<valRes.results.length ; a++)
            {
                _valFailures.push(valRes.results[a].errorMessage);
            }
            model_internal::expected_datetimeValidationFailureMessages_der = _valFailures;
        }
    }

    [Bindable(event="propertyChange")]
    public function get expected_datetimeValidationFailureMessages():Array
    {
        if (model_internal::_expected_datetimeValidationFailureMessages == null)
            model_internal::calculateExpected_datetimeIsValid();

        return _expected_datetimeValidationFailureMessages;
    }

    model_internal function set expected_datetimeValidationFailureMessages_der(value:Array) : void
    {
        var oldValue:Array = model_internal::_expected_datetimeValidationFailureMessages;

        var needUpdate : Boolean = false;
        if (oldValue == null)
            needUpdate = true;
    
        // avoid firing the event when old and new value are different empty arrays
        if (!needUpdate && (oldValue !== value && (oldValue.length > 0 || value.length > 0)))
        {
            if (oldValue.length == value.length)
            {
                for (var a:int=0; a < oldValue.length; a++)
                {
                    if (oldValue[a] !== value[a])
                    {
                        needUpdate = true;
                        break;
                    }
                }
            }
            else
            {
                needUpdate = true;
            }
        }

        if (needUpdate)
        {
            model_internal::_expected_datetimeValidationFailureMessages = value;   
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "expected_datetimeValidationFailureMessages", oldValue, value));
            // Only execute calculateIsValid if it has been called before, to update the validationFailureMessages for
            // the entire entity.
            if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
            {
                model_internal::_instance.model_internal::isValid_der = model_internal::_instance.model_internal::calculateIsValid();
            }
        }
    }

    [Bindable(event="propertyChange")]   
    public function get po_idStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    public function get po_idValidator() : StyleValidator
    {
        return model_internal::_po_idValidator;
    }

    model_internal function set _po_idIsValid_der(value:Boolean):void 
    {
        var oldValue:Boolean = model_internal::_po_idIsValid;         
        if (oldValue !== value)
        {
            model_internal::_po_idIsValid = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "po_idIsValid", oldValue, value));
        }                             
    }

    [Bindable(event="propertyChange")]
    public function get po_idIsValid():Boolean
    {
        if (!model_internal::_po_idIsValidCacheInitialized)
        {
            model_internal::calculatePo_idIsValid();
        }

        return model_internal::_po_idIsValid;
    }

    model_internal function calculatePo_idIsValid():void
    {
        var valRes:ValidationResultEvent = model_internal::_po_idValidator.validate(model_internal::_instance.po_id)
        model_internal::_po_idIsValid_der = (valRes.results == null);
        model_internal::_po_idIsValidCacheInitialized = true;
        if (valRes.results == null)
             model_internal::po_idValidationFailureMessages_der = emptyArray;
        else
        {
            var _valFailures:Array = new Array();
            for (var a:int = 0 ; a<valRes.results.length ; a++)
            {
                _valFailures.push(valRes.results[a].errorMessage);
            }
            model_internal::po_idValidationFailureMessages_der = _valFailures;
        }
    }

    [Bindable(event="propertyChange")]
    public function get po_idValidationFailureMessages():Array
    {
        if (model_internal::_po_idValidationFailureMessages == null)
            model_internal::calculatePo_idIsValid();

        return _po_idValidationFailureMessages;
    }

    model_internal function set po_idValidationFailureMessages_der(value:Array) : void
    {
        var oldValue:Array = model_internal::_po_idValidationFailureMessages;

        var needUpdate : Boolean = false;
        if (oldValue == null)
            needUpdate = true;
    
        // avoid firing the event when old and new value are different empty arrays
        if (!needUpdate && (oldValue !== value && (oldValue.length > 0 || value.length > 0)))
        {
            if (oldValue.length == value.length)
            {
                for (var a:int=0; a < oldValue.length; a++)
                {
                    if (oldValue[a] !== value[a])
                    {
                        needUpdate = true;
                        break;
                    }
                }
            }
            else
            {
                needUpdate = true;
            }
        }

        if (needUpdate)
        {
            model_internal::_po_idValidationFailureMessages = value;   
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "po_idValidationFailureMessages", oldValue, value));
            // Only execute calculateIsValid if it has been called before, to update the validationFailureMessages for
            // the entire entity.
            if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
            {
                model_internal::_instance.model_internal::isValid_der = model_internal::_instance.model_internal::calculateIsValid();
            }
        }
    }

    [Bindable(event="propertyChange")]   
    public function get pro_qtyStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    [Bindable(event="propertyChange")]   
    public function get stamp_numberStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    public function get stamp_numberValidator() : StyleValidator
    {
        return model_internal::_stamp_numberValidator;
    }

    model_internal function set _stamp_numberIsValid_der(value:Boolean):void 
    {
        var oldValue:Boolean = model_internal::_stamp_numberIsValid;         
        if (oldValue !== value)
        {
            model_internal::_stamp_numberIsValid = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "stamp_numberIsValid", oldValue, value));
        }                             
    }

    [Bindable(event="propertyChange")]
    public function get stamp_numberIsValid():Boolean
    {
        if (!model_internal::_stamp_numberIsValidCacheInitialized)
        {
            model_internal::calculateStamp_numberIsValid();
        }

        return model_internal::_stamp_numberIsValid;
    }

    model_internal function calculateStamp_numberIsValid():void
    {
        var valRes:ValidationResultEvent = model_internal::_stamp_numberValidator.validate(model_internal::_instance.stamp_number)
        model_internal::_stamp_numberIsValid_der = (valRes.results == null);
        model_internal::_stamp_numberIsValidCacheInitialized = true;
        if (valRes.results == null)
             model_internal::stamp_numberValidationFailureMessages_der = emptyArray;
        else
        {
            var _valFailures:Array = new Array();
            for (var a:int = 0 ; a<valRes.results.length ; a++)
            {
                _valFailures.push(valRes.results[a].errorMessage);
            }
            model_internal::stamp_numberValidationFailureMessages_der = _valFailures;
        }
    }

    [Bindable(event="propertyChange")]
    public function get stamp_numberValidationFailureMessages():Array
    {
        if (model_internal::_stamp_numberValidationFailureMessages == null)
            model_internal::calculateStamp_numberIsValid();

        return _stamp_numberValidationFailureMessages;
    }

    model_internal function set stamp_numberValidationFailureMessages_der(value:Array) : void
    {
        var oldValue:Array = model_internal::_stamp_numberValidationFailureMessages;

        var needUpdate : Boolean = false;
        if (oldValue == null)
            needUpdate = true;
    
        // avoid firing the event when old and new value are different empty arrays
        if (!needUpdate && (oldValue !== value && (oldValue.length > 0 || value.length > 0)))
        {
            if (oldValue.length == value.length)
            {
                for (var a:int=0; a < oldValue.length; a++)
                {
                    if (oldValue[a] !== value[a])
                    {
                        needUpdate = true;
                        break;
                    }
                }
            }
            else
            {
                needUpdate = true;
            }
        }

        if (needUpdate)
        {
            model_internal::_stamp_numberValidationFailureMessages = value;   
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "stamp_numberValidationFailureMessages", oldValue, value));
            // Only execute calculateIsValid if it has been called before, to update the validationFailureMessages for
            // the entire entity.
            if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
            {
                model_internal::_instance.model_internal::isValid_der = model_internal::_instance.model_internal::calculateIsValid();
            }
        }
    }

    [Bindable(event="propertyChange")]   
    public function get free_for_allocatedStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    [Bindable(event="propertyChange")]   
    public function get part_numberStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    public function get part_numberValidator() : StyleValidator
    {
        return model_internal::_part_numberValidator;
    }

    model_internal function set _part_numberIsValid_der(value:Boolean):void 
    {
        var oldValue:Boolean = model_internal::_part_numberIsValid;         
        if (oldValue !== value)
        {
            model_internal::_part_numberIsValid = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "part_numberIsValid", oldValue, value));
        }                             
    }

    [Bindable(event="propertyChange")]
    public function get part_numberIsValid():Boolean
    {
        if (!model_internal::_part_numberIsValidCacheInitialized)
        {
            model_internal::calculatePart_numberIsValid();
        }

        return model_internal::_part_numberIsValid;
    }

    model_internal function calculatePart_numberIsValid():void
    {
        var valRes:ValidationResultEvent = model_internal::_part_numberValidator.validate(model_internal::_instance.part_number)
        model_internal::_part_numberIsValid_der = (valRes.results == null);
        model_internal::_part_numberIsValidCacheInitialized = true;
        if (valRes.results == null)
             model_internal::part_numberValidationFailureMessages_der = emptyArray;
        else
        {
            var _valFailures:Array = new Array();
            for (var a:int = 0 ; a<valRes.results.length ; a++)
            {
                _valFailures.push(valRes.results[a].errorMessage);
            }
            model_internal::part_numberValidationFailureMessages_der = _valFailures;
        }
    }

    [Bindable(event="propertyChange")]
    public function get part_numberValidationFailureMessages():Array
    {
        if (model_internal::_part_numberValidationFailureMessages == null)
            model_internal::calculatePart_numberIsValid();

        return _part_numberValidationFailureMessages;
    }

    model_internal function set part_numberValidationFailureMessages_der(value:Array) : void
    {
        var oldValue:Array = model_internal::_part_numberValidationFailureMessages;

        var needUpdate : Boolean = false;
        if (oldValue == null)
            needUpdate = true;
    
        // avoid firing the event when old and new value are different empty arrays
        if (!needUpdate && (oldValue !== value && (oldValue.length > 0 || value.length > 0)))
        {
            if (oldValue.length == value.length)
            {
                for (var a:int=0; a < oldValue.length; a++)
                {
                    if (oldValue[a] !== value[a])
                    {
                        needUpdate = true;
                        break;
                    }
                }
            }
            else
            {
                needUpdate = true;
            }
        }

        if (needUpdate)
        {
            model_internal::_part_numberValidationFailureMessages = value;   
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "part_numberValidationFailureMessages", oldValue, value));
            // Only execute calculateIsValid if it has been called before, to update the validationFailureMessages for
            // the entire entity.
            if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
            {
                model_internal::_instance.model_internal::isValid_der = model_internal::_instance.model_internal::calculateIsValid();
            }
        }
    }

    [Bindable(event="propertyChange")]   
    public function get allocated_qtyStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    [Bindable(event="propertyChange")]   
    public function get po_detserialnumberStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    [Bindable(event="propertyChange")]   
    public function get po_confirm_dateStyle():com.adobe.fiber.styles.Style
    {
        return model_internal::_nullStyle;
    }

    public function get po_confirm_dateValidator() : StyleValidator
    {
        return model_internal::_po_confirm_dateValidator;
    }

    model_internal function set _po_confirm_dateIsValid_der(value:Boolean):void 
    {
        var oldValue:Boolean = model_internal::_po_confirm_dateIsValid;         
        if (oldValue !== value)
        {
            model_internal::_po_confirm_dateIsValid = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "po_confirm_dateIsValid", oldValue, value));
        }                             
    }

    [Bindable(event="propertyChange")]
    public function get po_confirm_dateIsValid():Boolean
    {
        if (!model_internal::_po_confirm_dateIsValidCacheInitialized)
        {
            model_internal::calculatePo_confirm_dateIsValid();
        }

        return model_internal::_po_confirm_dateIsValid;
    }

    model_internal function calculatePo_confirm_dateIsValid():void
    {
        var valRes:ValidationResultEvent = model_internal::_po_confirm_dateValidator.validate(model_internal::_instance.po_confirm_date)
        model_internal::_po_confirm_dateIsValid_der = (valRes.results == null);
        model_internal::_po_confirm_dateIsValidCacheInitialized = true;
        if (valRes.results == null)
             model_internal::po_confirm_dateValidationFailureMessages_der = emptyArray;
        else
        {
            var _valFailures:Array = new Array();
            for (var a:int = 0 ; a<valRes.results.length ; a++)
            {
                _valFailures.push(valRes.results[a].errorMessage);
            }
            model_internal::po_confirm_dateValidationFailureMessages_der = _valFailures;
        }
    }

    [Bindable(event="propertyChange")]
    public function get po_confirm_dateValidationFailureMessages():Array
    {
        if (model_internal::_po_confirm_dateValidationFailureMessages == null)
            model_internal::calculatePo_confirm_dateIsValid();

        return _po_confirm_dateValidationFailureMessages;
    }

    model_internal function set po_confirm_dateValidationFailureMessages_der(value:Array) : void
    {
        var oldValue:Array = model_internal::_po_confirm_dateValidationFailureMessages;

        var needUpdate : Boolean = false;
        if (oldValue == null)
            needUpdate = true;
    
        // avoid firing the event when old and new value are different empty arrays
        if (!needUpdate && (oldValue !== value && (oldValue.length > 0 || value.length > 0)))
        {
            if (oldValue.length == value.length)
            {
                for (var a:int=0; a < oldValue.length; a++)
                {
                    if (oldValue[a] !== value[a])
                    {
                        needUpdate = true;
                        break;
                    }
                }
            }
            else
            {
                needUpdate = true;
            }
        }

        if (needUpdate)
        {
            model_internal::_po_confirm_dateValidationFailureMessages = value;   
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "po_confirm_dateValidationFailureMessages", oldValue, value));
            // Only execute calculateIsValid if it has been called before, to update the validationFailureMessages for
            // the entire entity.
            if (model_internal::_instance.model_internal::_cacheInitialized_isValid)
            {
                model_internal::_instance.model_internal::isValid_der = model_internal::_instance.model_internal::calculateIsValid();
            }
        }
    }


     /**
     * 
     * @inheritDoc 
     */ 
     override public function getStyle(propertyName:String):com.adobe.fiber.styles.IStyle
     {
         switch(propertyName)
         {
            default:
            {
                return null;
            }
         }
     }
     
     /**
     * 
     * @inheritDoc 
     *  
     */  
     override public function getPropertyValidationFailureMessages(propertyName:String):Array
     {
         switch(propertyName)
         {
            case("pro_name"):
            {
                return pro_nameValidationFailureMessages;
            }
            case("expected_datetime"):
            {
                return expected_datetimeValidationFailureMessages;
            }
            case("po_id"):
            {
                return po_idValidationFailureMessages;
            }
            case("stamp_number"):
            {
                return stamp_numberValidationFailureMessages;
            }
            case("part_number"):
            {
                return part_numberValidationFailureMessages;
            }
            case("po_confirm_date"):
            {
                return po_confirm_dateValidationFailureMessages;
            }
            default:
            {
                return emptyArray;
            }
         }
     }

}

}
